home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 3 / Your Choice Software Collection 3.iso / os2 / fm2_207 / install.cmd < prev    next >
OS/2 REXX Batch file  |  1994-09-04  |  8KB  |  264 lines

  1. /*
  2.  * FM/2 2.x installation program copyright (c) 1994 by M. Kimes
  3.  *
  4.  * This program creates a folder to hold program objects,
  5.  * then creates program objects for each executable.  It only needs to be
  6.  * run once (unless you move the FM/2 directory -- see say notes at end).
  7.  * It also calls MIGINI.CMD if it finds an old FM2.INI file to migrate
  8.  * some information to the new version's FM3.INI file.
  9.  *
  10.  * For unattended installation, remove the lines marked with "NOTE:" below.
  11.  */
  12.  
  13. /* see if we might be in the right directory... */
  14.  
  15. '@Echo off'
  16. 'cls'
  17.  
  18. say'     ┌───────────────────────────────────────────────────────────────────┐'
  19. say'     │                  FM/2 2.x Installation Program                    │'
  20. say'     │             FM/2 is copyright (c) 1993/94 by M. Kimes             │'
  21. say'     │                       All rights reserved                         │'
  22. say'     ├───────────────────────────────────────────────────────────────────┤'
  23. say'     ├───────────────────────────────────────────────────────────────────┤'
  24. say'     │                Have you read the READ.ME file yet?                │'
  25. say'     │        By running this program, you agree to the license          │'
  26. say'     │                     as specified in that file,                    │'
  27. say'     │      and it tells you how to install, so you should read it.      │'
  28. say'     └───────────────────────────────────────────────────────────────────┘'
  29.  
  30. rc = stream('fm3.exe','c','query exists')
  31. if rc = '' then
  32. do
  33.   say 'Sorry, FM3.EXE not found.  Must not be right directory.  Terminating.'
  34.   exit
  35. end
  36.  
  37. /* tell user what we're doing, give him a chance to hit CTRL-C */
  38.  
  39. say ''
  40. say 'This program creates objects for FM/2.'
  41. say ''
  42.  
  43.  
  44.  
  45. /* NOTE:  remove following 3 lines for unattended use... */
  46. say 'Press [Enter].'
  47. pull dummy .
  48. say ''
  49.  
  50.  
  51. /* save current directory */
  52.  
  53. curdir = directory()
  54.  
  55. /* load rexx utility functions */
  56.  
  57. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  58. call SysLoadFuncs
  59.  
  60. /* say it, then do it */
  61.  
  62. say "Creating File Manager/2 folder and program objects..."
  63.  
  64. /* first, create FM/2 folder */
  65.  
  66. title = "File Manager/2"
  67. classname = 'WPFolder'
  68. location = '<WP_DESKTOP>'
  69. setup = 'OBJECTID=<FM3_Folder>;OPEN=DEFAULT'
  70. result=SysCreateObject(classname,title,location,setup,f)
  71.  
  72. /* NOTE:  remove following 9 lines for unattended use... */
  73. if result = 0 then
  74. do
  75.   say ''
  76.   say 'The File Manager/2 folder already exists.'
  77.   say 'Should I replace the objects? (Y/N)'
  78.   parse upper pull dummy
  79.   if left(dummy,1) = 'N' then exit
  80.   say ''
  81. end
  82.  
  83. /* now, create program objects in FM/2 folder */
  84.  
  85. title = "File Manager/2"
  86. classname = 'WPProgram'
  87. location = '<FM3_Folder>'
  88. setup = 'EXENAME='curdir'\FM3.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  89. call SysCreateObject classname,title,location,setup,u
  90.  
  91. rc = stream('av2.exe','c','query exists')
  92. if rc \= '' then
  93. do
  94.   title = "Archive Viewer/2"
  95.   classname = 'WPProgram'
  96.   location = '<FM3_Folder>'
  97.   setup = 'EXENAME='curdir'\AV2.EXE;PARAMETERS=%*;STARTUPDIR='curdir';ASSOCFILTER=*.ZIP,*.ARC,*.LZH,*.ARJ,*.ZOO,*.MO0'
  98.   call SysCreateObject classname,title,location,setup,u
  99. end
  100.  
  101. rc = stream('doicon.exe','c','query exists')
  102. if rc \= '' then
  103. do
  104.   title = "SysIcon"
  105.   classname = 'WPProgram'
  106.   location = '<FM3_Folder>'
  107.   setup = 'EXENAME='curdir'\DOICON.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  108.   call SysCreateObject classname,title,location,setup,u
  109. end
  110.  
  111. rc = stream('eas.exe','c','query exists')
  112. if rc \= '' then
  113. do
  114.   title = "EA Viewer"
  115.   classname = 'WPProgram'
  116.   location = '<FM3_Folder>'
  117.   setup = 'EXENAME='curdir'\EAS.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  118.   call SysCreateObject classname,title,location,setup,u
  119. end
  120.  
  121. rc = stream('ini.exe','c','query exists')
  122. if rc \= '' then
  123. do
  124.   title = "INI Viewer"
  125.   classname = 'WPProgram'
  126.   location = '<FM3_Folder>'
  127.   setup = 'EXENAME='curdir'\INI.EXE;PARAMETERS=%*;STARTUPDIR='curdir';ASSOCFILTER=*.INI'
  128.   call SysCreateObject classname,title,location,setup,u
  129. end
  130.  
  131. rc = stream('viewinfs.exe','c','query exists')
  132. if rc \= '' then
  133. do
  134.   title = "Bookshelf Viewer"
  135.   classname = 'WPProgram'
  136.   location = '<FM3_Folder>'
  137.   setup = 'EXENAME='curdir'\VIEWINFS.EXE;STARTUPDIR='curdir
  138.   call SysCreateObject classname,title,location,setup,u
  139.   title = "Helpfile Viewer"
  140.   classname = 'WPProgram'
  141.   location = '<FM3_Folder>'
  142.   setup = 'EXENAME='curdir'\VIEWINFS.EXE;PARAMETERS=DUMMY;STARTUPDIR='curdir
  143.   call SysCreateObject classname,title,location,setup,u
  144. end
  145.  
  146. rc = stream('killproc.exe','c','query exists')
  147. if rc \= '' then
  148. do
  149.   title = "Process Killer"
  150.   classname = 'WPProgram'
  151.   location = '<FM3_Folder>'
  152.   setup = 'EXENAME='curdir'\KILLPROC.EXE;PARAMETERS=%;STARTUPDIR='curdir
  153.   call SysCreateObject classname,title,location,setup,u
  154. end
  155.  
  156. rc = stream('undel.exe','c','query exists')
  157. if rc \= '' then
  158. do
  159.   title = "Undeleter"
  160.   classname = 'WPProgram'
  161.   location = '<FM3_Folder>'
  162.   setup = 'EXENAME='curdir'\UNDEL.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  163.   call SysCreateObject classname,title,location,setup,u
  164. end
  165.  
  166. rc = stream('vtree.exe','c','query exists')
  167. if rc \= '' then
  168. do
  169.   title = "Visual Tree"
  170.   classname = 'WPProgram'
  171.   location = '<FM3_Folder>'
  172.   setup = 'EXENAME='curdir'\VTREE.EXE;STARTUPDIR='curdir
  173.   call SysCreateObject classname,title,location,setup,u
  174. end
  175.  
  176. rc = stream('vdir.exe','c','query exists')
  177. if rc \= '' then
  178. do
  179.   title = "Visual Directory"
  180.   classname = 'WPProgram'
  181.   location = '<FM3_Folder>'
  182.   setup = 'EXENAME='curdir'\VDIR.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  183.   call SysCreateObject classname,title,location,setup,u
  184. end
  185.  
  186. rc = stream('vcollect.exe','c','query exists')
  187. if rc \= '' then
  188. do
  189.   title = "Collector"
  190.   classname = 'WPProgram'
  191.   location = '<FM3_Folder>'
  192.   setup = 'EXENAME='curdir'\VCOLLECT.EXE;STARTUPDIR='curdir
  193.   call SysCreateObject classname,title,location,setup,u
  194. end
  195.  
  196. /*
  197.  * create an FM2.CMD file that the user can copy into a directory
  198.  * in their PATH if they'd like to be able to start FM/2 from any
  199.  * directory via command line.
  200.  */
  201.  
  202. 'del FM2.CMD'
  203. dummy = stream('FM2.CMD','C','open')
  204. if dummy = 'READY:' then
  205. do
  206.   say 'Creating an FM2.CMD file.'
  207.   call lineout 'FM2.CMD', "/* FM/2 command file.  Locate in a directory"
  208.   call lineout 'FM2.CMD', " * on your PATH. */"
  209.   call lineout 'FM2.CMD', "'@echo off'"
  210.   call lineout 'FM2.CMD', "arg dummy"
  211.   call lineout 'FM2.CMD', "if dummy = '' then"
  212.   call lineout 'FM2.CMD', "  curdir = directory()"
  213.   call lineout 'FM2.CMD', "else"
  214.   call lineout 'FM2.CMD', "  curdir = ''"
  215.   call lineout 'FM2.CMD', "n = setlocal()"
  216.   call lineout 'FM2.CMD', "n = directory('"curdir"')"
  217.   call lineout 'FM2.CMD', "'start fm3.exe 'curdir' %1 %2 %3 %4 %5 %6 %7 %8 %9'"
  218.   call lineout 'FM2.CMD', "n = endlocal()"
  219.   call stream 'FM2.CMD','C','close'
  220. end
  221. else say "Couldn't create FM2.CMD file."
  222. say ''
  223.  
  224. /* if we can find FM2.INI, run MIGINI.CMD */
  225.  
  226. fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  227. if fm2ini \= '' then fm2ini = stream(fm2ini,'c','query exists')
  228. if fm2ini = '' then
  229. do
  230.   fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  231.   if fm2ini \= '' then
  232.   do
  233.     fm2ini = insert('\FM2.INI',fm2ini,length(fm2ini))
  234.     fm2ini = stream(fm2ini,'c','query exists')
  235.   end
  236. end
  237. fm2ini = SysSearchPath('PATH', 'FM2.INI')
  238. if fm2ini = '' then fm2ini = SysSearchPath('DPATH', 'FM2.INI')
  239. if fm2ini = '' then fm2ini = SysSearchPath('XPATH', 'FM2.INI')
  240. if fm2ini \= '' then
  241. do
  242.   'call migini.cmd dummy'
  243.   say ''
  244.   say '  (You can remove the old FM/2 1.x files when installation completes.)'
  245.   call SysSleep 2
  246.   say ''
  247. end
  248.  
  249. /* type the read.me file just so we're sure user had a _chance_ to see it */
  250.  
  251. /* NOTE:  remove following 4 lines for unattended use... */
  252. rc = stream('install.dat','c','query exists')
  253. if rc \= '' then 'type install.dat'
  254. say 'Press [Enter].'
  255. pull dummy .
  256.  
  257. say 'To move FM/2 to another directory, move the files, delete the FM/2 folder,'
  258. say 'then rerun INSTALL.  To remove FM/2, run UNINSTAL and follow its directions.'
  259. say "If you'd like to be able to run FM2 from any OS/2 command line, copy the"
  260. say 'FM2.CMD file in this directory to a directory on your PATH.'
  261. say ''
  262. say "I'm done now."
  263.  
  264.